<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title>16.JQ属性选择器</title>
		<link rel="stylesheet" href="../css/style.css" />
		<script type="text/javascript" src="../js/jquery-1.8.3.js" ></script>
		<script>
			$(function(){
				$("#btn1").click(function(){
					$("div[id]").css("background-color","red");
				});
				
				$("#btn2").click(function(){
					$("div[id='two']").css("background-color","red");
				});
			});
		</script>
		
		
	</head>
	<body>
		<input type="button" id="btn1" value="选择有id属性的div($(&quot;div[id]&quot;))"/>
		<input type="button" id="btn2" value="选择有id属性的值为two的div($(&quot;div[id='two']&quot;))"/>
		
		<hr/>
		<div id="one">
			<div class="mini">
				111
			</div>
		</div>
		
		<div id="two">
			<div class="mini">
				222
			</div>
			<div class="mini">
				333
			</div>
		</div>
		
		<div id="three">
			<div class="mini">
				444
			</div>
			<div class="mini">
				555
			</div>
			<div class="mini">
				666
			</div>
		</div>
		
		<span id="four">
			
		</span>
		
		<br /><br /><br /><br /><br /><br /><br /><br /><br />
		<font color="black" size="4px">
			&lt;script>
				<br />&emsp;$(function(){
					<br />&emsp;&emsp;$("#btn1").click(function(){
						<br />&emsp;&emsp;&emsp;$("div[id]").css("background-color","red");
					<br />&emsp;&emsp;});
					<br />
					<br />&emsp;&emsp;$("#btn2").click(function(){
						<br />&emsp;&emsp;&emsp;$("div[id='two']").css("background-color","red");
					<br />&emsp;&emsp;});
				<br />&emsp;});
			<br />&lt;/script>
		</font>
	</body>
</html>
